﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiscreteMath.Tests
{
    public class TestableAutomaton : TestableDevice<NondeterministicAutomaton>
    {
        public TestableAutomaton(
            NondeterministicAutomaton automaton,
            string name, Func<string, bool> recognition,
            string regex,
            int minimizedNumberOfStates,
            int determinedNumberOfStates) :
            base(automaton, name)
        {
            RecognitionTest = recognition;
            Regex = regex;
            MinimizedNumberOfStates = minimizedNumberOfStates;
            DeterminedNumberOfStates = determinedNumberOfStates;
        }

        public Func<string, bool> RecognitionTest { get; set; }

        public int MinimizedNumberOfStates { get; set; }

        public int DeterminedNumberOfStates { get; set; }

        public string Regex { get; set; }

        public static implicit operator NondeterministicAutomaton (TestableAutomaton automaton)
        {
            return automaton.Device;
        }

        public static explicit operator DeterministicAutomaton (TestableAutomaton automaton)
        {
            return automaton.Device as DeterministicAutomaton;
        }
    }
}
